package com.amigo.online.provider.adv.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface AdvApplyAreaMapper {

    @Select({" <script>"
            + " select adv_id, area_id from adv_tantan_apply_area_tbl where adv_id in"
            + " <foreach collection='advIds' item='advId' open='(' close=')' separator=','>"
            + "	#{advId}"
            + "	</foreach>"
            + " </script>"})
    @MapKey("adv_id")
    Map<Long, List<Long>> getTantanApplyAreaIdsByApplyIds(@Param("advIds") List<Long> ids);

    @Select("select area_id from adv_tantan_apply_area_tbl where adv_id = #{advId}")
    List<Integer> getTantanApplyAreaIdsByApplyId(@Param("advId") long id);

    @Select("select area_id from adv_nearby_apply_area_tbl where adv_id = #{advId}")
    List<Integer> getNearbyApplyAreaIdsByApplyId(@Param("advId") long id);

    @Select("select area_id from adv_home_apply_area_tbl where adv_id = #{advId}")
    List<Integer> getHomeApplyAreaIdsByApplyId(@Param("advId") long id);

    @Select("select area_id from adv_recommend_apply_area_tbl where adv_id = #{advId}")
    List<Integer> getRecommendApplyAreaIdsByApplyId(@Param("advId") long id);
}
